import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

export const useDanmuStore = defineStore('danmu', () => {
    //定义弹幕状态
    const isDanmuVisible = ref(true);// 控制弹幕显示状态的数据属性
    const message = ref('')
    const backgroundColor = ref('#333')
    const textColor = ref('#fff')
    const visible = ref(false)
    //定义弹幕状态切换
    const toggleDanmuVisible = () => {
        isDanmuVisible.value =!isDanmuVisible.value
    }
    //用户进入直播间通知
    const showNotification = (newMessage, newBackgroundColor, newTextColor) =>{
        message.value = newMessage || '欢迎来到直播间';
        backgroundColor.value = newBackgroundColor || '#333'
        textColor.value = newTextColor || '#fff'
        visible.value = true
    }
    return{
        message,
        textColor,
        backgroundColor,
        visible,
        isDanmuVisible,
        toggleDanmuVisible,
        showNotification
    }
})
